<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title>MapBoxGL</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
    <!-- <link href="./lib/mapboxdev/mapbox-gl.css" rel="stylesheet" />
		<script src="lib/mapboxdev/mapbox-gl.js"></script> -->
    <script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.54.0/mapbox-gl.js'></script>
    <link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.54.0/mapbox-gl.css' rel='stylesheet' />
    <style>
        body {
            margin: 0;
            padding: 0;
        }

        #map {
            position: absolute;
            top: 0;
            bottom: 0;
            width: 100%;
        }

        .mapboxgl-canvas {
            outline: none;
        }
    </style>
</head>

<body>
    <div id="map"></div>
    <script>
        let localhost = window.location.origin;
        let sources = {
            "osm-tiles1": {
                "type": "raster",
                'tiles': [
                    "http://t0.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=ebf64362215c081f8317203220f133eb",
                ],
                'tileSize': 256
            },
            "osm-tiles2": {
                "type": "raster",
                'tiles': [
                    "http://t0.tianditu.gov.cn/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=ebf64362215c081f8317203220f133eb",
                ],
                'tileSize': 256
            }
        };
        let layers = [{
            "id": "simple-tiles1",
            "type": "raster",
            "source": "osm-tiles1",
        },
        {
            "id": "simple-tiles2",
            "type": "raster",
            "source": "osm-tiles2",
        }
        ];
        var map = new mapboxgl.Map({
            container: 'map',
            style: {
                "version": 8,
                "sprite": localhost + "/MapBoxGL/css/sprite",
                "glyphs": localhost + "/MapBoxGL/css/font/{fontstack}/{range}.pbf",
                "sources": sources,
                "layers": layers,
            },
            center: [117.110805, 36.663046],
            zoom: 4
        });
        map.on('load', function () {

        });
    </script>

</body>

</html>